package com.mes.cloud.web.productpricegroup;

import com.mes.cloud.api.dto.request.productpricegroup.ProductCustomerGroupCustomerBatchDeleteRequest;
import com.mes.cloud.api.dto.request.productpricegroup.ProductCustomerGroupCustomerBindCustomerRequest;
import com.mes.cloud.api.dto.request.productpricegroup.ProductCustomerGroupCustomerListRequest;
import com.mes.cloud.api.dto.response.productpricegroup.ProductCustomerGroupCustomerDto;
import com.mes.cloud.common.JsonResult;
import com.mes.cloud.service.productpricegroup.ProductCustomerGroupCustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import javax.validation.Valid;

/**
 * @author wxm
 * @version 2019-09-24 14:49:06
 * @email xiaomin.wu1@pactera.com
 */
@Api(tags = "产品客户组-客户关联", value = "产品客户组-客户关联接口")
@RestController
@RequestMapping(value = "/productCustomerGroupCustomer")
public class ProductCustomerGroupCustomerController {

    private ProductCustomerGroupCustomerService productCustomerGroupCustomerService;

    @Autowired
    public ProductCustomerGroupCustomerController(ProductCustomerGroupCustomerService productCustomerGroupCustomerService) {
        this.productCustomerGroupCustomerService = productCustomerGroupCustomerService;
    }

    /**
     * 功能: 产品客户组-客户关联查询所有
     *
     * @param productCustomerGroupCustomerListRequest
     * @return JsonResult<List<ProductCustomerGroupCustomerDto>>
     */
    @ApiOperation(value = "产品客户组-客户关联查询所有", notes = "产品客户组-客户关联查询所有")
    @PostMapping(value = "/list")
    public JsonResult<List<ProductCustomerGroupCustomerDto>> list(@RequestBody ProductCustomerGroupCustomerListRequest productCustomerGroupCustomerListRequest) {
        return productCustomerGroupCustomerService.list(productCustomerGroupCustomerListRequest);
    }

    /**
     * 功能: 产品客户组-绑定客户
     *
     * @param productCustomerGroupCustomerBindCustomerRequest
     * @return
     */
    @ApiOperation(value = "产品客户组-绑定客户", notes = "产品客户组-绑定客户")
    @PostMapping(value = "/bindCustomer")
    public JsonResult bindCustomer(@Valid @RequestBody ProductCustomerGroupCustomerBindCustomerRequest productCustomerGroupCustomerBindCustomerRequest) {
        return productCustomerGroupCustomerService.bindCustomer(productCustomerGroupCustomerBindCustomerRequest);
    }

    /**
     * 功能: 产品客户组-删除客户
     *
     * @param productCustomerGroupCustomerBatchDeleteRequest
     * @return
     */
    @ApiOperation(value = "产品客户组-删除客户", notes = "产品客户组-删除客户")
    @PostMapping(value = "/batchDelete")
    public JsonResult batchDelete(@Valid @RequestBody ProductCustomerGroupCustomerBatchDeleteRequest productCustomerGroupCustomerBatchDeleteRequest) {
        return productCustomerGroupCustomerService.batchDelete(productCustomerGroupCustomerBatchDeleteRequest);
    }
}
